#include "dialogaffichagedelot.h"

DialogAffichageDELot::DialogAffichageDELot(QWidget *parent) :
    QDialog(parent)
{
    ui.setupUi(this);
}

DialogAffichageDELot::DialogAffichageDELot(QWidget *parent,QList<QString> listeNomImage) :
    QDialog(parent)
{
    int i;
    QString legende;

    ui.setupUi(this);

    ui.labelLegende->setText("Correspondance numéro - image\n");
    for(i=0;i<listeNomImage.count();i++)
    {
        legende = QString("  %1 - %2\n").arg(i).arg(listeNomImage.at(i));
        ui.labelLegende->setText(ui.labelLegende->text() + legende);
    }

    ui.tableWidget->setColumnCount(4);
    QString header = "Images,Sombre,Median,Clair";
    ui.tableWidget->setHorizontalHeaderLabels(header.split(","));
}

DialogAffichageDELot::~DialogAffichageDELot()
{

}

void DialogAffichageDELot::AddRow(int indexImage1, int indexImage2,  float deSombre, float deMedian, float deClair)
{
    int row =  ui.tableWidget->rowCount();
    ui.tableWidget->setRowCount(row+1);
    ui.tableWidget->setItem(row,0,new QTableWidgetItem(QString("%1 - %2").arg(indexImage1).arg(indexImage2)));
    ui.tableWidget->setItem(row,1,new QTableWidgetItem(QString("%1").arg(deSombre)));
    ui.tableWidget->setItem(row,2,new QTableWidgetItem(QString("%1").arg(deMedian)));
    ui.tableWidget->setItem(row,3,new QTableWidgetItem(QString("%1").arg(deClair)));
}

